/**
 * 
 */
package fr.upvm.lem3.vm3d.ui.swing.menu;

import javax.swing.JFrame;
import javax.swing.UIManager;

import com.sun.j3d.utils.applet.MainFrame;

import fr.upvm.lem3.vm3d.ui.swing.frontend.MainGUI;
import fr.upvm.lem3.vm3d.ui.swing.util.MyWindowsLookAndFeel;

/**
 * manage the event between the menuBar components, the main frame and the rest of the application
 *******************************************************************
 *MyMenuBarController.java
 *15.02.2012
 *@author Guy Nougouapi
 *******************************************************************
 *
 *******************************************************************
 */
public class MyMenuBarController {
	
	private MyMenuBar menuBar;
	
	/**
	 * 
	 */
	public MyMenuBarController(MyMenuBar menuBar){
		this.setMenuBar(menuBar);
	}

	/**
	 * exit the application
	 */
	public void systemExit(){
		((MainGUI)getMenuBar().getParentFrame()).getController().exitFrame();
	}
	/**
	 * show the user the  information about the software on a panel 
	 */
	public void showInfoMsg() {
		// TODO Auto-generated method stub
		Info.showInfoMsg((MainGUI)getMenuBar().getParentFrame());
		
	}
	/**
	 * @return the menuBar
	 */
	public MyMenuBar getMenuBar() {
		return menuBar;
	}

	/**
	 * @param menuBar the menuBar to set
	 */
	public void setMenuBar(MyMenuBar menuBar) {
		this.menuBar = menuBar;
	}
	
	/**
	 * set the look and feel of the main frame and its components and children
	 * @param i	
	 * 			i = 0 (for the System look and feel)
	 * 			i = 1 (for the java look and feel)
	 * 			i=  2 (for the Motif look and feel) 
	 */
	public void setLookAndFeel(int i) {
		
		if (i == 0){
			MyWindowsLookAndFeel.setNativeLookAndFeel((MainGUI)getMenuBar().getParentFrame());
		}else {
			if ( i==1){
					MyWindowsLookAndFeel.setJavaLookAndFeel((MainGUI)getMenuBar().getParentFrame());
					
			}else {
				if ( i == 2){
						MyWindowsLookAndFeel.setMotifLookAndFeel((MainGUI)getMenuBar().getParentFrame());
						}
			}
		}
	}

	
	
}
